#import "TranquilVelvetController.h"
        
#import "TranquilVelvetModel.h"
#import "TranquilVelvetCell.h"
#import "Masonry.h"

@interface TranquilVelvetController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *radiateTableView;
@property (nonatomic, strong) NSMutableArray *invincibleWonderArr;

@end

@implementation TranquilVelvetController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self hummingbirdZestfulConfiglayout];
	[self wonderTonicAppleloadData];
}


//: 懒加载数据模型数组
- (NSMutableArray *)invincibleWonderArr {
	if (!_invincibleWonderArr) {
		_invincibleWonderArr = [NSMutableArray array];
	}
	return _invincibleWonderArr;
}

- (void)hummingbirdZestfulConfiglayout {
    self.radiateTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.radiateTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    self.radiateTableView.estimatedRowHeight = 0;
    self.radiateTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.radiateTableView.contentInset = UIEdgeInsetsMake(16, 0, 16, 0);
    self.radiateTableView.delegate = self;
    self.radiateTableView.dataSource = self;
    self.radiateTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.radiateTableView.showsVerticalScrollIndicator = NO;
    self.radiateTableView.showsHorizontalScrollIndicator = NO;
    self.radiateTableView.backgroundColor = UIColor.clearColor;
    [self.radiateTableView registerClass:[TranquilVelvetCell class] forCellReuseIdentifier:NSStringFromClass([TranquilVelvetCell class])];
    [self.view addSubview:self.radiateTableView];
    [self.radiateTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(self.view);
        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
    }];
}

//: 获取数据模型
- (void)wonderTonicAppleloadData {
	
}

#pragma mark - UITableView DataSource 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.invincibleWonderArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    TranquilVelvetCell *rippleSilhouetteFlexibility = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([TranquilVelvetCell class])];
    if (rippleSilhouetteFlexibility == nil) {
        rippleSilhouetteFlexibility = [[TranquilVelvetCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([TranquilVelvetCell class])];
    }
    rippleSilhouetteFlexibility.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return rippleSilhouetteFlexibility;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	TranquilVelvetModel *joyfulOracle = self.invincibleWonderArr[indexPath.row];
	return joyfulOracle.embarkCellHeight;
}


#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // cell tap action
}


@end
